package com.cn.demo4.service.impl;

import com.cn.demo4.dao.HrDao;
import com.cn.demo4.dao.impl.HrDaoImpl;
import com.cn.demo4.model.HrModel;
import com.cn.demo4.service.IHrService;

import java.util.List;

public class HrServiceImpl implements IHrService {
    @Override
    public List<HrModel> findAll(HrModel hrModel) {
        HrDao hrDao = new HrDaoImpl();
        return hrDao.findAll(hrModel);
    }

    @Override
    public String add(HrModel hrModel) {
        HrDao hrDao = new HrDaoImpl();
        return hrDao.add(hrModel) == 1 ? "success" : "error";
    }

    @Override
    public int del(Integer id) {
        HrDao hrDao = new HrDaoImpl();
        return hrDao.del(id);
    }

    @Override
    public String update(HrModel hrModel) {
        HrDao hrDao = new HrDaoImpl();
        return hrDao.update(hrModel) == 1 ? "success" : "error";
    }

    @Override
    public HrModel findById(Integer id) {

        HrDao hrDao = new HrDaoImpl();
        return hrDao.findById(id);
    }

    @Override
    public List<HrModel> getHrModelListForHome() {
        HrDao hrDao = new HrDaoImpl();
        return hrDao.getHrModelListForHome() ;
    }

    @Override
    public int getCount(HrModel hrModel) {
        HrDao hrDao = new HrDaoImpl();
        return hrDao.getCount(hrModel);
    }
}
